import pynotify
import gtk
import commands
import subprocess

pynotify.init("MemoBee")
def exe_note(note,status_icon):
	notify = pynotify.Notification(note.title,note.body)
	notify.set_timeout(30000)
	pixbuf = gtk.gdk.pixbuf_new_from_file("tray.svg")
	notify.set_icon_from_pixbuf(pixbuf)
	notify.attach_to_status_icon(status_icon)
	notify.show()

def exe_launcher(launcher,status_icon):
	notify = pynotify.Notification("Launcher Execution",launcher.command)
	notify.set_timeout(1000)
	pixbuf = gtk.gdk.pixbuf_new_from_file("tray.svg")
	notify.set_icon_from_pixbuf(pixbuf)
	notify.attach_to_status_icon(status_icon)
	notify.show()
	if launcher.terminal == True :
		x = subprocess.Popen('xterm -e '+launcher.command,shell=True)
	else:
		x = subprocess.Popen(launcher.command, shell=True)
